USE EstudiosComerciales
go
IF OBJECT_ID('dbo.WASP_D0004_CREA_TABLA_OPAPF000') IS NOT NULL
BEGIN
    DROP PROCEDURE dbo.WASP_D0004_CREA_TABLA_OPAPF000
    IF OBJECT_ID('dbo.WASP_D0004_CREA_TABLA_OPAPF000') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE dbo.WASP_D0004_CREA_TABLA_OPAPF000 >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE dbo.WASP_D0004_CREA_TABLA_OPAPF000 >>>'
END
go
SET ANSI_NULLS ON
go
SET QUOTED_IDENTIFIER ON
go
CREATE PROCEDURE WASP_D0004_CREA_TABLA_OPAPF000
AS

BEGIN
if exists (select * from dbo.sysobjects where id = object_id(N'[SQL].[OPAPF000]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [SQL].[OPAPF000]
END

CREATE TABLE [SQL].[OPAPF000] (
	[CODAGENCIA] [decimal](2, 0)  ,
	[CLVEMPRESA] [decimal](9, 0) ,
	[DVEEMPRESA] [char] (1) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[NOMEMPRESA] [char] (40) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[DIREMPRESA] [char] (94) COLLATE Modern_Spanish_CI_AS NULL ,
	[RUTEMPRESA] [decimal](8, 0) NOT NULL ,
	[DVRUTEMPRE] [char] (1) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[FECAFILEMP] [decimal](6, 0) NOT NULL ,
	[FECDESAEMP] [decimal](8, 0) NOT NULL ,
	[ACTIVEMPRE] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[COMPINEMPR] [decimal](5, 0) NOT NULL ,
	[NOMREPLEGE] [char] (40) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[RUTREPLEGE] [decimal](8, 0) NOT NULL ,
	[DVRUTREPLE] [char] (1) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[NROTRABEMP] [decimal](8, 0) NULL ,
	[TOTIMPOEMP] [decimal](11, 2) NULL ,
	[ESTADOEMPR] [decimal](1, 0) NOT NULL ,
	[CONDIEMPRE] [decimal](2, 0) NULL ,
	[CONVEEMPRE] [char] (5) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[NOTAEMPRE] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[FULTCOTEMP] [varchar] (50) COLLATE Modern_Spanish_CI_AS NOT NULL ,
	[FULTDECEMP] [decimal](8, 0) NULL ,
	[TOTCOTIMPE] [decimal](11, 2) NULL ,
	[TOTCOMPAFE] [decimal](9, 2) NULL ,
	[MESMORAEMP] [decimal](2, 0) NULL ,
	[CRDTOEMPRE] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[APORTEMPRE] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[STSETIQETA] [decimal](3, 0) NULL ,
	[STSMODREGE] [decimal](1, 0) NULL ,
	[FECMODREGE] [decimal](8, 0) NULL ,
	[USRMODREGE] [char] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[INDPLAAFA] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[INDPLACSO] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[NUMFONO1] [char] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[NUMFONO2] [char] (10) COLLATE Modern_Spanish_CI_AS NULL ,
	[NUMFAX] [char] (13) COLLATE Modern_Spanish_CI_AS NULL ,
	[CODEJE] [smallint] NULL ,
	[FPRICOTIZ] [decimal](8, 0) NULL ,
	[MARCA] [char] (1) COLLATE Modern_Spanish_CI_AS NULL ,
	[NTRABAFIL] [decimal](5, 0) NULL ,
	[FILLER] [char] (12) COLLATE Modern_Spanish_CI_AS NULL ,
	[CTABT] [decimal](9, 0) NULL ,
	[TIPCTABT] [decimal](6, 0) NULL,
	[BLO_EMPRE] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
  [FECCONTRAEMP] [decimal](6, 0)  NOT NULL
) ON [PRIMARY]
go
SET ANSI_NULLS OFF
go
SET QUOTED_IDENTIFIER OFF
go
IF OBJECT_ID('dbo.WASP_D0004_CREA_TABLA_OPAPF000') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE dbo.WASP_D0004_CREA_TABLA_OPAPF000 >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE dbo.WASP_D0004_CREA_TABLA_OPAPF000 >>>'
go
